<!DOCTYPE html>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    
    <title th:text="|${@config.getKey('sys.name')}注册|">注册</title>
    <meta name="description" th:content="${@config.getKey('sys.name')}">
    <link href="../static/css/bootstrap.min.css" th:href="@{/css/bootstrap.min.css}" rel="stylesheet"/>
    <link href="../static/css/font-awesome.min.css" th:href="@{/css/font-awesome.min.css}" rel="stylesheet"/>
    <link href="../static/css/style.css" th:href="@{/css/style.css}" rel="stylesheet"/>
    <link href="../static/css/login.css" th:href="@{/css/login.css}" rel="stylesheet"/>
    <link href="../static/ruoyi/css/ry-ui.css" th:href="@{/ruoyi/css/ry-ui.css?v=3.4.0}" rel="stylesheet"/>
    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->
    <link rel="shortcut icon" href="../static/favicon.ico" th:href="@{favicon.ico}"/>
    <style type="text/css">label.error { position:inherit;  }</style>
    <script>
        if(window.top!==window.self){window.top.location=window.location};
    </script>
</head>

<body class="signin">

    <div class="signinpanel">
        <div class="row">
            <div class="col-sm-5">
                <form id="signupForm">
                    <h4 class="no-margins">系统注册：</h4>
                    <input type="text" id="loginName"    name="loginName" class="form-control uname"     placeholder="登录名"     />
                    <input type="text" id="userName"     name="userName" class="form-control username"     placeholder="姓名"     />
                    <input type="password" name="password" class="form-control pword"     placeholder="密码"     />
                    <input type="email" name="email" class="form-control email"     placeholder="邮箱"     />
                    <input type="number" name="phonenumber" class="form-control phone"     placeholder="手机号"     />
                    <div class="checkbox-custom" th:classappend="${captchaEnabled==false} ? 'm-t'">
                        <a onclick="tologin()">已有账号，登录</a>
                    </div>
                    <button class="btn btn-success btn-block" onclick="regis()" data-loading="正在验证注册，请稍后...">注册</button>
                </form>
            </div>
        </div>
        <div class="signup-footer">
            <div class="pull-left" th:text="${@config.getKey('sys.copyright')}"></div>
        </div>
    </div>
<script th:inline="javascript"> 
	var ctx = [[@{/}]]; 
	var captchaType = [[${captchaType}]]; 
	function tologin(){
		window.location.href = ctx + "login"
	}
	
	function regis() {
		var loginName = $.common.trim($("#loginName").val());
		var userName = $.common.trim($("#userName").val());
	    var password = $.common.trim($("input[name='password']").val());
	    var email = $.common.trim($("#email").val());
	    var phonenumber = $.common.trim($("#phonenumber").val());
	    $.ajax({
	        type: "post",
	        url: ctx + "register",
	        data: {
	            "loginName": loginName,
	            "userName": userName,
	            "password": password,
	            "email" : email,
	            "phonenumber": phonenumber
	        },
	        success: function(r) {
	            if (r.code == 0) {
	                location.href = ctx + 'login';
	            } else {
	            	$.modal.msg(r.msg);
	            }
	        }
	    });
	}
</script>
<!-- 全局js -->
<script src="../static/js/jquery.min.js" th:src="@{/js/jquery.min.js}"></script>
<script src="../static/js/bootstrap.min.js" th:src="@{/js/bootstrap.min.js}"></script>
<!-- 验证插件 -->
<script src="../static/ajax/libs/validate/jquery.validate.min.js" th:src="@{/ajax/libs/validate/jquery.validate.min.js}"></script>
<script src="../static/ajax/libs/validate/messages_zh.min.js" th:src="@{/ajax/libs/validate/messages_zh.min.js}"></script>
<script src="../static/ajax/libs/layer/layer.min.js" th:src="@{/ajax/libs/layer/layer.min.js}"></script>
<script src="../static/ajax/libs/blockUI/jquery.blockUI.js" th:src="@{/ajax/libs/blockUI/jquery.blockUI.js}"></script>
<script src="../static/ruoyi/js/ry-ui.js" th:src="@{/ruoyi/js/ry-ui.js?v=3.4.0}"></script>
</body>
</html>
